/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

constexpr int maxn = 1e5;

char a[maxn + 1], b[maxn + 1];

int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    cin >> (a + 1) >> (b + 1);

    int ans1 = 0;
    for (int i = 1; i <= n; ++i) {
      ans1 += (a[i] != b[i]);
    }
    int ans2 = 0;
    for (int i = 1; i <= n; ++i) {
      ans2 += (a[i] != b[n - i + 1]);
    }

    if (ans2 == 0) {
      cout << (ans1 != 0 ? 2 : 0) << '\n';
    } else
      cout << std::min(ans1 % 2 ? ans1 * 2 - 1 : ans1 * 2,
                       ans2 % 2 ? ans2 * 2 : ans2 * 2 - 1)
           << '\n';
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("C. Game with Reversing.in", "r", stdin);
  freopen("C. Game with Reversing.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
